import os,sys
#os.system('py manage.py')

def f1(cmd):
    return cmd+'1'

def exit_with_help():
    print 'Usage: python import_broadPeak.py importList'
    exit(1)

if len(sys.argv)<2:
    exit_with_help()

fi=open(sys.argv[1],'r')
i=0
beg=0
for line in fi:
    line=line.strip()
    if line=='wgEncodeUwDgfHmvechHotspots':
    	beg=1
    	continue
    if len(line)<1 or not beg:
    	continue
    i+=1
    cmd='py ../gis-basic-storage/console/bcs.py load mongodb_table -F encodeBroadPeak:encodeBroadPeak --tags=\'assembly=hg19;UCSC_name='+line+'\' -i ./broadPeak/'+line+'.broadPeak'
    #print cmd
    os.system(cmd)
    #if i>5:
    #	break
fi.close()
